package com.mrjy.maintain.controller;

import com.mrjy.common.entity.SubscriptionInfo;
import com.mrjy.maintain.bo.ISubscriptionInfoBo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
@RequestMapping("/maintain/subscriptionInfo")
public class SubscriptionInfoController {
    @Resource
    private ISubscriptionInfoBo subscriptionInfoBo;


    /**
     * @return
     */
    @RequestMapping("/insert")
    @ResponseBody
    public Object insert(SubscriptionInfo info) {
        return subscriptionInfoBo.txInsert(info);
    }


    /**
     * @return
     */
    @RequestMapping("/deleteByIds")
    @ResponseBody
    public Object deleteByIds(int[] ids) {
        return subscriptionInfoBo.txDeleteByIds(ids);
    }

    /**
     * @return
     */
    @RequestMapping("/updateById")
    @ResponseBody
    public Object updateById(SubscriptionInfo info) {
        return subscriptionInfoBo.txUpdateById(info);
    }

    /**
     * @return
     */
    @RequestMapping("/updateDisableFlag")
    @ResponseBody
    public Object updateDisableFlag(SubscriptionInfo info) {
        return subscriptionInfoBo.txUpdateDisableFlag(info);
    }

    /**
     * 根据userId和teacherId来查询
     *
     * @return
     */
    @RequestMapping("/queryByUserIdTeacherId")
    @ResponseBody
    public Object queryByUserIdTeacherId(SubscriptionInfo info) {
        return subscriptionInfoBo.queryByUserIdTeacherId(info);
    }

    /**
     * 根据userId和teacherId来查询
     *
     * @return
     */
    @RequestMapping("/isSubscript")
    @ResponseBody
    public Object isSubscript(SubscriptionInfo info) {
        return subscriptionInfoBo.isSubscript(info);
    }

    /**
     * 订阅
     *
     * @return
     */
    @RequestMapping("/updateSub")
    @ResponseBody
    public Object updateSub(SubscriptionInfo info) {
        return subscriptionInfoBo.updateSub(info);
    }


}
